<%@page contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true" pageEncoding="UTF-8" %>
<html>
<head>
    <%@include file="/WEB-INF/include/include.jsp" %>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form layui-card-header layuiadmin-card-header-auto" action="${pageContext.request.contextPath}/system/user/list" method="get">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <shiro:hasPermission name="user:query">
                        <div class="layui-inline">
                            <input type="text" name="name" value="${query.name}" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                        </div>
                        <button class="layui-btn layui-btn-normal" lay-submit="">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                        <button class="layui-btn layui-btn-normal go-btn" data-url="${pageContext.request.contextPath}/system/user/list">
                            <i class="layui-icon layui-icon-refresh layuiadmin-button-btn"></i>
                        </button>
                    </shiro:hasPermission>
                </div>
            </div>
        </form>
        <div class="layui-card-body">
            <div class="layui-inline">
                <div style="padding-bottom: 10px;">
                    <shiro:hasPermission name="user:add">
                        <button class="layui-btn layui-btn-normal go-btn" data-url="${pageContext.request.contextPath}/system/user/add">
                            <i class="layui-icon">&#xe654;</i>
                        </button>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="user:del">
                        <button class="layui-btn layui-btn-danger delBtn" data-url="${pageContext.request.contextPath}/system/user/deletes">
                            <i class="layui-icon">&#xe640;</i>
                        </button>
                    </shiro:hasPermission>
                </div>
            </div>
            <div class="layui-form" id="table-list">
                <table class="layui-table" lay-even>
                    <colgroup>
                        <col width="5%">
                        <col width="14%">
                        <col width="14%">
                        <col width="10%">
                        <col width="11%">
                        <col width="10%">
                        <col width="20%">
                        <col width="16%">
                    </colgroup>
                    <thead>
                    <tr>

                        <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                        <th>账号</th>
                        <th>姓名</th>
                        <th>部门</th>
                        <th>职务</th>
                        <th>状态</th>
                        <th>角色</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="model" items="${page.list}">
                        <tr>
                            <td><input type="checkbox" name="" lay-skin="primary" data-id="${model.id}"></td>
                            <td>${model.username}</td>
                            <td>${model.name}</td>
                            <td>${model.systemDept.name}</td>
                            <td>${model.systemDuty.name}</td>
                            <td>
                                <c:if test="${model.isEnable == true}">启用</c:if>
                                <c:if test="${model.isEnable == false}"><font color="red">停用</font></c:if>
                            </td>
                            <td>
                                <c:forEach var="role" items="${model.systemRoleList}" varStatus="var">${role.name}<c:if test="${!var.last}">，</c:if></c:forEach>
                            </td>
                            <td>
                                <div class="layui-inline">
                                    <shiro:hasPermission name="user:edit">
                                        <button class="layui-btn layui-btn-xs layui-btn-normal go-btn hidden-xs" data-id="${model.id}"
                                                data-url="${pageContext.request.contextPath}/system/user/edit/${model.id}" title="编辑"><i class="layui-icon">&#xe642;编辑</i>
                                        </button>
                                    </shiro:hasPermission>
                                    <shiro:hasPermission name="user:role_set">
                                        <button class="layui-btn layui-btn-xs layui-btn-normal go-btn hidden-xs" data-id="${model.id}"
                                                data-url="${pageContext.request.contextPath}/system/user/role_set/${model.id}" title="角色分配"><i class="layui-icon">&#xe612;角色分配</i>
                                        </button>
                                    </shiro:hasPermission>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <%@include file="/WEB-INF/include/page.jsp" %>
</div>
</body>
</html>